<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile

/** @var \Magento\Review\Block\Product\ReviewRenderer $block */

$url = $block->getReviewsUrl() . '#reviews';
$urlForm = $block->getReviewsUrl() . '#review-form';
?>
<?php if ($block->getReviewsCount()): ?>
<?php $rating = $block->getRatingSummary(); ?>
<div class="product-reviews-summary short<?php echo !$rating ? ' no-rating' : ''?>">
    <?php if ($rating):?>
    <div class="rating-summary">
        <span class="label"><span><?php echo $block->escapeHtml(__('Rating')) ?>:</span></span>
        <div class="rating-result" title="<?php echo $block->escapeHtmlAttr($rating); ?>%">
            <span style="width:<?php echo $block->escapeHtmlAttr($rating); ?>%"><span><?php echo $block->escapeHtml($rating); ?>%</span></span>
        </div>
    </div>
    <?php endif;?>
    <div class="reviews-actions">
        <a class="action view" href="<?php echo $block->escapeUrl($url) ?>"><?php echo $block->escapeHtml($block->getReviewsCount()) ?>&nbsp;<span><?php echo($block->getReviewsCount() == 1) ? $block->escapeHtml(__('Review')) : $block->escapeHtml(__('Reviews')) ?></span></a>
    </div>
</div>
<?php elseif ($block->getDisplayIfEmpty()): ?>
<div class="product-reviews-summary short empty">
    <div class="reviews-actions">
        <a class="action add" href="<?php echo $block->escapeUrl($urlForm); ?>">
            <?php echo $block->escapeHtml(__('Be the first to review this product')) ?>
        </a>
    </div>
</div>
<?php endif; ?>
